package com.ss.SmartStock.service;

import com.ss.SmartStock.common.ErrorCode;
import com.ss.SmartStock.exception.BusinessException;
import com.ss.SmartStock.pojo.dto.user.UserLoginRequest;
import com.ss.SmartStock.pojo.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Select;

import javax.servlet.http.HttpServletRequest;

import static com.ss.SmartStock.constant.UserConstant.USER_LOGIN_STATE;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author author
 * @since 2024-06-17
 */
public interface UserService extends IService<User> {


    /**
     * 用户登录
     * @param userLoginRequest
     * @param request
     * @return
     */

    User login(UserLoginRequest userLoginRequest, HttpServletRequest request);

    /**
     * 获取当前登录用户
     */
    User getLoginUser(HttpServletRequest request);


    /**
     * 注销
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);


    /**
     * 用户注册
     * @param userAccount
     * @param userPassword
     * @param checkPassword
     * @return
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 是否为管理员
     */
    boolean isAdmin(User user);
}
